local scriptend = false -- local rs = game:GetService("RunService") local plrs = game:GetService("Players") -- local plr = owner local uid = plr.UserId -- local ra = Random.new() -- local remotepar = game:GetService("TestService") for i,v in pairs(remotepar:children()) do if v:isA("RemoteEvent") and v:GetAttribute("rr") == uid then v:Destroy() end if v:isA("BasePart") and v:GetAttribute("r") == uid then v:Destroy() end end task.wait() local ls local gu -- local lssource = [[ task.wait(1/60) script.Parent = nil local plrs = game:GetService("Players") local plr = plrs.LocalPlayer local uis = game:GetService("UserInputService") local remotepar = game:GetService("TestService") local remote local lastcamcf local camrot = Vector2.new(0,math.rad(15)) function invalidremote() return (remote == nil or remote:GetAttribute("rr") ~= plr.UserId or remote:IsDescendantOf(remotepar) == false) end function invalidcam() local cam = workspace.CurrentCamera return (cam.CameraSubject == nil or cam.CameraSubject:GetAttribute("r") ~= plr.UserId or cam.CameraSubject:IsDescendantOf(remotepar) == false) end function fireremote(...) if invalidremote() then return end remote:FireServer(...) end game:GetService("RunService").Heartbeat:Connect(function() local cam = workspace.CurrentCamera local findcam = invalidcam() local findrem = invalidremote() if findcam or findrem then for i,v in pairs(remotepar:children()) do if findrem then if v:IsA("RemoteEvent") and v:GetAttribute("rr") == plr.UserId then remote = v end end if findcam then if v:IsA("UnionOperation") and v:GetAttribute("r") == plr.UserId then cam.CameraSubject = v end end end end if lastcamcf ~= cam.CFrame then lastcamcf = cam.CFrame fireremote("camcf",cam.CFrame) end end) local dist = 14 workspace.CurrentCamera.Focus = CFrame.new(math.random(-10000,10000),math.random(-10000,10000),math.random(-10000,10000)) -- uis.InputChanged:connect(function(input,gpe) if gpe then return end if input.UserInputType == Enum.UserInputType.MouseWheel and workspace.CurrentCamera.CameraSubject and not invalidcam() then if input.Position.Z < 0 then dist = dist*.8 else if dist <= 0 then dist = 1 end dist = dist*1.25 end end end) uis.InputBegan:Connect(function(io,gpe) if gpe then return end if io.UserInputType == Enum.UserInputType.MouseWheel and workspace.CurrentCamera.CameraSubject and not invalidcam() then if io.Position.Z < 0 then dist = dist*.8 else if dist <= 0 then dist = 1 end dist = dist*1.25 end end fireremote("keydown",io.KeyCode.Name:lower()) end) uis.InputEnded:Connect(function(io,gpe) if gpe then return end fireremote("keyup",io.KeyCode.Name:lower()) end) uis.TextBoxFocusReleased:Connect(function() fireremote("stopmovement") end) -- game:GetService("RunService").RenderStepped:Connect(function(dt) if uis:IsKeyDown(Enum.KeyCode.I) and uis:GetFocusedTextBox() == nil then dist = dist*.8 end if uis:IsKeyDown(Enum.KeyCode.O) and uis:GetFocusedTextBox() == nil then if dist <= 0 then dist = 1 end dist = dist*1.25 end if uis:IsKeyDown(Enum.KeyCode.Left) and uis:GetFocusedTextBox() == nil then camrot = camrot - Vector2.new(math.rad(3),0) end if uis:IsKeyDown(Enum.KeyCode.Right) and uis:GetFocusedTextBox() == nil then camrot = camrot + Vector2.new(math.rad(3),0) end dist = math.max(dist,0) local cam = workspace.CurrentCamera cam.CameraType = Enum.CameraType.Scriptable if uis:IsMouseButtonPressed(Enum.UserInputType.MouseButton2) then uis.MouseBehavior = Enum.MouseBehavior.LockCurrentPosition else uis.MouseBehavior = Enum.MouseBehavior.Default end if cam.CameraSubject and not invalidcam() then camrot = camrot + uis:GetMouseDelta() * math.rad(uis.MouseDeltaSensitivity / 4) local y = camrot.Y y = math.clamp(y,-math.rad(90),math.rad(90)) camrot = Vector2.new(camrot.X,y) cam.CFrame = CFrame.new(cam.CameraSubject.Position)*CFrame.Angles(0,-camrot.X,0)*CFrame.Angles(-camrot.Y,0,0)*CFrame.new(0,0,dist) end end) ]] function givels(plr) local s = Instance.new("ScreenGui") s.Parent = plr.PlayerGui s.ResetOnSpawn = false ls = NLS(lssource,s) gu = s end -- local rems = {} local bps = {} local bpcframe = {} local joints = { ls = { C0 = CFrame.new(-1, 0.5, 0)*CFrame.Angles(0,math.rad(-90),0), C1 = CFrame.new(0.5, 0.5, 0)*CFrame.Angles(0,math.rad(-90),0), Transform = CFrame.new(), }, rs = { C0 = CFrame.new(1, 0.5, 0)*CFrame.Angles(0,math.rad(-90),0), C1 = CFrame.new(-0.5, 0.5, 0)*CFrame.Angles(0,math.rad(-90),0), Transform = CFrame.new(), }, lh = { C0 = CFrame.new(-1, -1, 0)*CFrame.Angles(0,math.rad(-90),0), C1 = CFrame.new(-0.5, 1, 0)*CFrame.Angles(0,math.rad(-90),0), Transform = CFrame.new(), }, rh = { C0 = CFrame.new(1, -1, 0)*CFrame.Angles(0,math.rad(-90),0), C1 = CFrame.new(0.5, 1, 0)*CFrame.Angles(0,math.rad(-90),0), Transform = CFrame.new(), }, rj = { C0 = CFrame.new(), C1 = CFrame.new(), Transform = CFrame.new(), }, nk = { C0 = CFrame.new(0, 1, 0)*CFrame.Angles(math.rad(-90),math.rad(180),0), C1 = CFrame.new(0, -0.5, 0)*CFrame.Angles(math.rad(-90),math.rad(180),0), Transform = CFrame.new(), }, } -- function rem() local i = Instance.new('RemoteEvent') i.Name = math.random() return i end function part() local p = Instance.new("Part") p.CanQuery = false p.CanTouch = false p.CanCollide = false p.Anchored = true p.Name = math.random() p.CastShadow = false return p end function mesh() local i = Instance.new("FileMesh") i.Name = math.random() return i end function decal() local i = Instance.new("Decal") i.Name = math.random() return i end function headmesh(part) local m = Instance.new("SpecialMesh") m.Scale = Vector3.new(1.25/part.Size.X,1.25/part.Size.Y,1.25/part.Size.Z) m.Name = math.random() return m end function safedestroy(part) pcall(game.Destroy,part) end function isdestroyed(part,par) par = par or workspace local s,f = pcall(function() part.Parent = par end) return part.Parent ~= par end function refitpart(bpname,setting) if setting.class then bps[bpname] = Instance.new(setting.class) bps[bpname].Name = math.random() else bps[bpname] = part() end bps[bpname].Size = Vector3.new(ra:NextNumber(-50,50),ra:NextNumber(-50,50),ra:NextNumber(-50,50)) if setting.attribute then bps[bpname]:SetAttribute(setting.attribute,setting.attvalue) end if bpcframe[bpname] then bps[bpname].CFrame = bpcframe[bpname] end if bpcframe[bpname] == nil then bpcframe[bpname] = CFrame.new() end local cons = {} local lastmesh local lc local dead = false if setting.meshid then local mesho mesho = function() if dead then return end if lastmesh then safedestroy(lastmesh) end if lc then lc:Disconnect() lc = nil end local m = mesh() lastmesh = m m.Name = math.random() m.MeshId = setting.meshid if setting.scale then m.Scale = setting.scale end m.Parent = bps[bpname] cons[#cons+1] = m:GetPropertyChangedSignal("Parent"):Connect(mesho) lc = cons[#cons+1] end mesho() elseif setting.headmesh then headmesh(bps[bpname]).Parent = bps[bpname] end if setting.decalid then local deca = decal() deca.Texture = setting.decalid deca.Parent = bps[bpname] end local function die() if dead then return end dead = true if lastmesh then safedestroy(lastmesh) end if lc then lc:Disconnect() lc = nil end for i,v in pairs(cons) do v:Disconnect() end if scriptend then return end cons = nil local last = bps[bpname] refitpart(bpname,setting) rs.Stepped:Wait() safedestroy(last) end bps[bpname].Parent = setting.parent or workspace cons[#cons+1] = bps[bpname]:GetPropertyChangedSignal("Parent"):Connect(function() if isdestroyed(bps[bpname],setting.parent) then die() end end) local cha = false local dies = 0 cons[#cons+1] = bps[bpname]:GetPropertyChangedSignal("CFrame"):Connect(function() if bpcframe[bpname] and bps[bpname].CFrame ~= bpcframe[bpname] then if not cha then cha = true task.spawn(function() rs.Heartbeat:Wait() dies = 0 cha = false end) end dies = dies + 1 if dies >= 9 then die() end end end) if setting.attribute then cons[#cons+1] = bps[bpname].AttributeChanged:Connect(function() if bps[bpname]:GetAttribute(setting.attribute) == nil or bps[bpname]:GetAttribute(setting.attribute) ~= setting.attvalue then bps[bpname]:SetAttribute(setting.attribute,setting.attvalue) end end) end end function refitrem(bpname,setting) rems[bpname] = setting.class and Instance.new(setting.class) or rem() rems[bpname].Name = math.random() if setting.attribute then rems[bpname]:SetAttribute(setting.attribute,setting.attvalue) end local cons = {} local dead = false local function die() if dead then return end dead = true for i,v in pairs(cons) do v:Disconnect() end if scriptend then return end cons = nil local last = rems[bpname] refitrem(bpname,setting) rs.Stepped:Wait() safedestroy(last) end cons[#cons+1] = rems[bpname][setting.eventname]:Connect(setting.event) rems[bpname].Parent = remotepar cons[#cons+1] = rems[bpname]:GetPropertyChangedSignal("Parent"):Connect(function() if isdestroyed(rems[bpname],setting.parent) then die() end end) if setting.attribute then cons[#cons+1] = rems[bpname].AttributeChanged:Connect(function() if rems[bpname]:GetAttribute(setting.attribute) == nil or rems[bpname]:GetAttribute(setting.attribute) ~= setting.attvalue then rems[bpname]:SetAttribute(setting.attribute,setting.attvalue) end end) end end function setcf(bp,cf) workspace:BulkMoveTo({bps[bp]},{cf},Enum.BulkMoveMode.FireCFrameChanged) end function setcharcf(camcf) workspace:BulkMoveTo({ bps.la, bps.ra, bps.ll, bps.rl, bps.tr, bps.hed, bps.cam },{ bpcframe.la, bpcframe.ra, bpcframe.ll, bpcframe.rl, bpcframe.tr, bpcframe.hed, camcf },Enum.BulkMoveMode.FireCFrameChanged) end -- refitpart("la",{ meshid = "rbxassetid://488154609", scale = Vector3.one*.01 }) refitpart("ra",{ meshid = "rbxassetid://488155216", scale = Vector3.one*.01 }) refitpart("ll",{ meshid = "rbxassetid://488154609", scale = Vector3.one*.01 }) refitpart("rl",{ meshid = "rbxassetid://488155216", scale = Vector3.one*.01 }) refitpart("tr",{ meshid = "rbxassetid://489667862", scale = Vector3.one*.01 }) refitpart("hed",{ headmesh = true }) refitpart("cam",{ meshid = "", parent = remotepar, attribute = "r", attvalue = uid, class = "UnionOperation" }) -- local speed = 16 local jumppower= 50 local jump = false local charpos = CFrame.new(0,10,0) local hipheight = 0 local camcf = CFrame.new() local w,s,a,d = 0,0,0,0 local chatter,hb local fallspeed = 0 -- function playerjoin(po) if chatter then chatter:Disconnect() chatter = nil end plr = po givels(plr) chatter = plr.Chatted:Connect(function(m) if m == "end/" then hb:Disconnect() hb = nil scriptend = true safedestroy(ls) safedestroy(gu) ls = nil gu = nil for i,v in pairs(bps) do v:Destroy() end for i,v in pairs(rems) do v:Destroy() end chatter:Disconnect() end end) end function playerleave() if chatter then chatter:Disconnect() chatter = nil end end playerjoin(plr) -- refitrem("control",{ attribute = "rr", attvalue = uid, class = "RemoteEvent", eventname = "OnServerEvent", event = function(g,ty,key) if g ~= plr then return end if ty == "stopmovement" then w,s,a,d = 0,0,0,0 end if ty == "keydown" then if key == "w" or key == "up" then w = 1 end if key == "a" then a = 1 end if key == "s" or key == "down" then s = 1 end if key == "d" then d = 1 end if key == "space" then jump = true end end if ty == "camcf" then camcf = key end if ty == "keyup" then if key == "w" or key == "up" then w = 0 end if key == "a" then a = 0 end if key == "s" or key == "down" then s = 0 end if key == "d" then d = 0 end if key == "space" then jump = false end end end, }) -- hb = game:GetService("RunService").Heartbeat:Connect(function(dt) if plr then plr.Character = nil end local lastcharpos = charpos local prediction = charpos local right = camcf.RightVector local frontVector = -(right:Cross(Vector3.new(0, 1, 0) )) local mdir = (frontVector*(w-s)) + (right * (d-a)) local dirs = mdir.Unit if dirs ~= dirs then dirs = Vector3.new() end prediction = prediction+(dirs*(speed*(dt))) local ray = Ray.new(prediction.Position,Vector3.new(0,-(4+hipheight),0)) local colision = Ray.new(prediction.Position,(lastcharpos.Position-prediction.Position)) local hit,pos,norm = workspace:FindPartOnRayWithIgnoreList(ray,{bps.la,bps.ra,bps.ll,bps.rl,bps.tr,bps.hed},false,true) local chit,cpos,cnorm = workspace:FindPartOnRayWithIgnoreList(colision,{bps.la,bps.ra,bps.ll,bps.rl,bps.tr,bps.hed},false,true) if hit then fallspeed = 0 prediction = prediction*CFrame.new(0,pos.Y-prediction.Y+3,0) if jump then prediction = prediction+Vector3.new(0,1,0) fallspeed = fallspeed-jumppower/50 end else fallspeed = fallspeed + (workspace.Gravity*dt/60) prediction = prediction - Vector3.new(0,fallspeed,0) end if mdir.Magnitude > 0 then local ang = prediction-prediction.Position local g = CFrame.new(Vector3.new(prediction.X,lastcharpos.Y,prediction.Z),lastcharpos.Position) local s = g-g.Position local lerp = ang:Lerp(s,.2) local x,y,z = lerp:ToOrientation() local ori = CFrame.fromOrientation(0,y,0) prediction = CFrame.new(prediction.Position)*ori end if chit then prediction = CFrame.new(cpos+Vector3.new(0,(cpos.Y-prediction.Y+3),0))*CFrame.Angles(prediction:ToEulerAnglesXYZ()) end charpos = prediction bpcframe.tr = prediction*joints.rj.C0*joints.rj.Transform*joints.rj.C1:Inverse() bpcframe.la = bpcframe.tr*joints.ls.C0*joints.ls.Transform*joints.ls.C1:Inverse() bpcframe.ra = bpcframe.tr*joints.rs.C0*joints.rs.Transform*joints.rs.C1:Inverse() bpcframe.ll = bpcframe.tr*joints.lh.C0*joints.lh.Transform*joints.lh.C1:Inverse() bpcframe.rl = bpcframe.tr*joints.rh.C0*joints.rh.Transform*joints.rh.C1:Inverse() bpcframe.hed = bpcframe.tr*joints.nk.C0*joints.nk.Transform*joints.nk.C1:Inverse() setcharcf(prediction*CFrame.new(0,1.5+hipheight,0)) end)